#@layoutT('编辑表单')
#define main()
	#include("_form.html")
#end

<!-- 保存数据 -->
#define layuiFunc()	
	var saveUrl="#(path)/portal/form/sql/update";
#end


<script type="text/javascript">
$(function(){
	//获取url中的参数
	var searchURL=window.location.search;
	searchURL = searchURL.substring(1, searchURL.length);
	var target = searchURL.split("&")[0].split("=")[1];
	var editUrl="#(path)/portal/form/sql/getModel/"+target;
	//发送请求
	$.post(editUrl, {}, function(ret) {
		if (ret.state=="ok") {console.log(ret.data)
			var data=ret.data;
			//页面赋值
			$.each(data,function(key,val){
				$('input[name="'+key+'"]').val(val);
				if(key=="content")ddlSql.setValue(val);
			});
			$('input[name="code"]').attr("readonly","readonly");
			$('input[name="code"]').attr("class","layui-input layui-disabled");
		} else {
			warn(ret.msg);
		}
	});
});
</script>
